//vuex共享状态的封装
//创建一个store存储器对象
import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"
//导入state.js等文件
import state from './state'
import mutations from './mutations'
import actions from './actions'
import getters from './getters'

Vue.use(Vuex)

export default new Vuex.Store({
    state,
    mutations,
    actions,
    getters,
    //路由的本地存储
    plugins: [createPersistedState({
        storage: window.localStorage,
        key: "elm",
        render(state) {
            return {...state }
        }
    })]
  })